﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data.Entities
{
    public partial class _Issue : RaisingStudio.Data.Expressions.TableExpression, RaisingStudio.Data.Expressions.IQueryExpression<_Issue>
    {
        #region Constructor (s) / Destructor
        /// <summary>
        /// Constructor (s) / Destructor.
        /// </summary>
        public _Issue() : base("Issue")
        {
        }
        #endregion
        #region Members
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _IssueID = "IssueID";
        public RaisingStudio.Data.Expressions.ColumnExpression IssueID { get { return _IssueID; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Title = "Title";
        public RaisingStudio.Data.Expressions.ColumnExpression Title { get { return _Title; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Description = "Description";
        public RaisingStudio.Data.Expressions.ColumnExpression Description { get { return _Description; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Status = "Status";
        public RaisingStudio.Data.Expressions.ColumnExpression Status { get { return _Status; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _IssueType = "IssueType";
        public RaisingStudio.Data.Expressions.ColumnExpression IssueType { get { return _IssueType; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Owner = "Owner";
        public RaisingStudio.Data.Expressions.ColumnExpression Owner { get { return _Owner; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Progress = "Progress";
        public RaisingStudio.Data.Expressions.ColumnExpression Progress { get { return _Progress; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _CreateTime = "CreateTime";
        public RaisingStudio.Data.Expressions.ColumnExpression CreateTime { get { return _CreateTime; } }
        public static readonly RaisingStudio.Data.Expressions.ColumnExpression _Locked = "Locked";
        public RaisingStudio.Data.Expressions.ColumnExpression Locked { get { return _Locked; } }

		#endregion

        public static implicit operator RaisingStudio.Data.Expressions.ConditionExpression(_Issue Issue)
        {
            return new RaisingStudio.Data.Expressions.ConditionExpression();
        }

        public RaisingStudio.Data.Expressions.ConditionExpression OrderBy(RaisingStudio.Data.Expressions.ColumnExpression columnExpression)
        {
             RaisingStudio.Data.Expressions.ConditionExpression conditionExpression = this;
             return conditionExpression.OrderBy(columnExpression);
        }

        public RaisingStudio.Data.Expressions.ConditionExpression OrderBy(RaisingStudio.Data.Expressions.ColumnExpression columnExpression, RaisingStudio.Data.Expressions.SortingDirection sortingDirection)
        {
            RaisingStudio.Data.Expressions.ConditionExpression conditionExpression = this;
            return conditionExpression.OrderBy(columnExpression, sortingDirection);
        }

        public RaisingStudio.Data.Expressions.ConditionExpression Where(RaisingStudio.Data.Expressions.ExpressionElement expressionElement)
        {
            RaisingStudio.Data.Expressions.ConditionExpression conditionExpression = this;
            return conditionExpression.Where(expressionElement);
        }

        public static implicit operator RaisingStudio.Data.Expressions.ColumnExpressionCollection(_Issue Issue)
        {
            return new RaisingStudio.Data.Expressions.ColumnExpressionCollection(Issue);
        }

        public static implicit operator RaisingStudio.Data.Expressions.ColumnExpression[](_Issue Issue)
        {
            return new RaisingStudio.Data.Expressions.ColumnExpression[]
                        {                            
                            Issue.IssueID,
                            Issue.Title,
                            Issue.Description,
                            Issue.Status,
                            Issue.IssueType,
                            Issue.Owner,
                            Issue.Progress,
                            Issue.CreateTime,
                            Issue.Locked,
                        };
        }

        public RaisingStudio.Data.Expressions.ColumnExpressionCollection Except(params RaisingStudio.Data.Expressions.ColumnExpression[] columns)
        {
            RaisingStudio.Data.Expressions.ColumnExpressionCollection columnExpressionCollection = this;
            return columnExpressionCollection.Except(columns);
        }

    
        public static implicit operator RaisingStudio.Data.Expressions.QueryExpression<_Issue>(_Issue Issue)
        {
            return new RaisingStudio.Data.Expressions.QueryExpression<_Issue>(Issue);
        }


        #region IQueryExpression<_Issue> 成员

        _Issue RaisingStudio.Data.Expressions.IQueryExpression<_Issue>.Value
        {
            get { return Issue._; }
        }

        #endregion

        #region IQueryExpression 成员

        RaisingStudio.Data.Expressions.TableExpression RaisingStudio.Data.Expressions.IQueryExpression.Table
        {
            get { return this; }
        }

        RaisingStudio.Data.Expressions.ConditionExpression RaisingStudio.Data.Expressions.IQueryExpression.Condition
        {
            get { return this; }
        }

        RaisingStudio.Data.Expressions.ColumnExpressionCollection RaisingStudio.Data.Expressions.IQueryExpression.Columns
        {
            get { return null; }
        }

        #endregion
    }

    partial class Issue
    {
        #region Members
        public static readonly _Issue _ = new _Issue();
		#endregion
    }
}
